<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>oauth2client.multistore_file</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="oauth2client-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="oauth2client-module.html">Package&nbsp;oauth2client</a> ::
        Module&nbsp;multistore_file
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="oauth2client.multistore_file-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module multistore_file</h1><p class="nomargin-top"><span class="codelink"><a href="oauth2client.multistore_file-pysrc.html">source&nbsp;code</a></span></p>
<pre class="literalblock">
Multi-credential file store with lock support.

This module implements a JSON credential store where multiple
credentials can be stored in one file. That file supports locking
both in a single process and across processes.

The credential themselves are keyed off of:
* client_id
* user_agent
* scope

The format of the stored data is like so:
{
  'file_version': 1,
  'data': [
    {
      'key': {
        'clientId': '&lt;client id&gt;',
        'userAgent': '&lt;user agent&gt;',
        'scope': '&lt;scope&gt;'
      },
      'credential': {
        # JSON serialized Credentials.
      }
    }
  ]
}

</pre>

<hr />
<div class="fields">      <p><strong>Author:</strong>
        jbeda@google.com (Joe Beda)
      </p>
</div><!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Classes"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="oauth2client.multistore_file.Error-class.html" class="summary-name">Error</a><br />
      Base error for this module.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="oauth2client.multistore_file.NewerCredentialStoreError-class.html" class="summary-name">NewerCredentialStoreError</a><br />
      The credential store is a newer version that supported.
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="oauth2client.multistore_file._MultiStore-class.html" class="summary-name" onclick="show_private();">_MultiStore</a><br />
      A file backed store for multiple credentials.
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.multistore_file-module.html#get_credential_storage" class="summary-sig-name">get_credential_storage</a>(<span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">client_id</span>,
        <span class="summary-sig-arg">user_agent</span>,
        <span class="summary-sig-arg">scope</span>,
        <span class="summary-sig-arg">warn_on_readonly</span>=<span class="summary-sig-default">True</span>)</span><br />
      Get a Storage instance for a credential.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.multistore_file-pysrc.html#get_credential_storage">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.multistore_file-module.html#get_credential_storage_custom_string_key" class="summary-sig-name">get_credential_storage_custom_string_key</a>(<span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">key_string</span>,
        <span class="summary-sig-arg">warn_on_readonly</span>=<span class="summary-sig-default">True</span>)</span><br />
      Get a Storage instance for a credential using a single string as a key.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.multistore_file-pysrc.html#get_credential_storage_custom_string_key">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.multistore_file-module.html#get_credential_storage_custom_key" class="summary-sig-name">get_credential_storage_custom_key</a>(<span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">key_dict</span>,
        <span class="summary-sig-arg">warn_on_readonly</span>=<span class="summary-sig-default">True</span>)</span><br />
      Get a Storage instance for a credential using a dictionary as a key.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.multistore_file-pysrc.html#get_credential_storage_custom_key">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.multistore_file-module.html#get_all_credential_keys" class="summary-sig-name">get_all_credential_keys</a>(<span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">warn_on_readonly</span>=<span class="summary-sig-default">True</span>)</span><br />
      Gets all the registered credential keys in the given Multistore.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.multistore_file-pysrc.html#get_all_credential_keys">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.multistore_file-module.html#_get_multistore" class="summary-sig-name" onclick="show_private();">_get_multistore</a>(<span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">warn_on_readonly</span>=<span class="summary-sig-default">True</span>)</span><br />
      A helper method to initialize the multistore with proper locking.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.multistore_file-pysrc.html#_get_multistore">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="logger"></a><span class="summary-name">logger</span> = <code title="logging.getLogger(__name__)">logging.getLogger(__name__)</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="_multistores"></a><span class="summary-name">_multistores</span> = <code title="{}">{}</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="_multistores_lock"></a><span class="summary-name">_multistores_lock</span> = <code title="threading.Lock()">threading.Lock()</code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="get_credential_storage"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">get_credential_storage</span>(<span class="sig-arg">filename</span>,
        <span class="sig-arg">client_id</span>,
        <span class="sig-arg">user_agent</span>,
        <span class="sig-arg">scope</span>,
        <span class="sig-arg">warn_on_readonly</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.multistore_file-pysrc.html#get_credential_storage">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Get a Storage instance for a credential.

Args:
  filename: The JSON file storing a set of credentials
  client_id: The client_id for the credential
  user_agent: The user agent for the credential
  scope: string or iterable of strings, Scope(s) being requested
  warn_on_readonly: if True, log a warning if the store is readonly

Returns:
  An object derived from client.Storage for getting/setting the
  credential.

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@util.positional(4)</code></li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="get_credential_storage_custom_string_key"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">get_credential_storage_custom_string_key</span>(<span class="sig-arg">filename</span>,
        <span class="sig-arg">key_string</span>,
        <span class="sig-arg">warn_on_readonly</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.multistore_file-pysrc.html#get_credential_storage_custom_string_key">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Get a Storage instance for a credential using a single string as a key.

Allows you to provide a string as a custom key that will be used for
credential storage and retrieval.

Args:
  filename: The JSON file storing a set of credentials
  key_string: A string to use as the key for storing this credential.
  warn_on_readonly: if True, log a warning if the store is readonly

Returns:
  An object derived from client.Storage for getting/setting the
  credential.

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@util.positional(2)</code></li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="get_credential_storage_custom_key"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">get_credential_storage_custom_key</span>(<span class="sig-arg">filename</span>,
        <span class="sig-arg">key_dict</span>,
        <span class="sig-arg">warn_on_readonly</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.multistore_file-pysrc.html#get_credential_storage_custom_key">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Get a Storage instance for a credential using a dictionary as a key.

Allows you to provide a dictionary as a custom key that will be used for
credential storage and retrieval.

Args:
  filename: The JSON file storing a set of credentials
  key_dict: A dictionary to use as the key for storing this credential. There
    is no ordering of the keys in the dictionary. Logically equivalent
    dictionaries will produce equivalent storage keys.
  warn_on_readonly: if True, log a warning if the store is readonly

Returns:
  An object derived from client.Storage for getting/setting the
  credential.

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@util.positional(2)</code></li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="get_all_credential_keys"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">get_all_credential_keys</span>(<span class="sig-arg">filename</span>,
        <span class="sig-arg">warn_on_readonly</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.multistore_file-pysrc.html#get_all_credential_keys">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Gets all the registered credential keys in the given Multistore.

Args:
  filename: The JSON file storing a set of credentials
  warn_on_readonly: if True, log a warning if the store is readonly

Returns:
  A list of the credential keys present in the file.  They are returned as
  dictionaries that can be passed into get_credential_storage_custom_key to
  get the actual credentials.

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@util.positional(1)</code></li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="_get_multistore"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_get_multistore</span>(<span class="sig-arg">filename</span>,
        <span class="sig-arg">warn_on_readonly</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.multistore_file-pysrc.html#_get_multistore">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
A helper method to initialize the multistore with proper locking.

Args:
  filename: The JSON file storing a set of credentials
  warn_on_readonly: if True, log a warning if the store is readonly

Returns:
  A multistore object

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@util.positional(1)</code></li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="oauth2client-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Sep 29 15:21:51 2014
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
